home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / src / td01_src.lha / td_r0.1 / sl3 / source / geoa / geoa.c next >
Encoding:
C/C++ Source or Header  |  1999-06-19  |  20.3 KB  |  811 lines

  1. /*
  2. **      $VER: geoa.c 1.00 (19.6.1999)
  3. **
  4. **      Creation date : 8.5.1999
  5. **
  6. **      Description       :
  7. **         Standart 3d extension module for tdo.library.
  8. **         Loads and saves the mesh as Videoscape ASCII file.
  9. **
  10. **
  11. **      Written by Stephan Bielmann
  12. **
  13. */
  14.  
  15. /*************************** Includes *******************************/
  16.  
  17. /*
  18. ** Ansi C includes
  19. */
  20. #include <math.h>
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <stdlib.h>
  24.  
  25. /*
  26. ** Amiga includes
  27. */
  28. #include <dos/dos.h>
  29. #include <dos/stdio.h>
  30.  
  31. #include <clib/dos_protos.h>
  32.  
  33. /*
  34. ** Project includes
  35. */
  36. #include "td_public.h"
  37. #include "compiler.h"
  38. #include "td.h"
  39.  
  40. /**************************** Defines *******************************/
  41.  
  42. /*
  43. ** Number of elements in the buffers
  44. */
  45. #define Ci_MAXVERINPOLY 200    // maximum vertices in a polygon
  46.  
  47. /*********************** Type definitions ***************************/
  48.  
  49. /*
  50. ** Color structure
  51. */
  52. struct TColor {
  53.     UBYTE r,g,b;
  54. };
  55.  
  56. /*************************** Variables ******************************/
  57.  
  58. /*
  59. ** Videoscape equivalent rgb colors.
  60. */
  61. static const TColor colorTbl[] = {
  62. {  0,  0,  0},{  0,  0,178},{  0,178,  0},{  0,178,178},{178,  0,  0},{255,127,255},
  63. {204,153,102},{127,127,127},{  0,  0,  0},{102,102,255},{102,255,102},{  0,255,100},
  64. {255,102,102},{255,204,255},{255,255,  0},{255,255,255}
  65. };
  66.  
  67. /********************** Private functions ***************************/
  68.  
  69. /********************************************************************\
  70. *                                                                    *
  71. * Name         : magnitude                                           *
  72. *                                                                    *
  73. * Description  : Calculates the magnitude of a color vector.         *
  74. *                                                                    *
  75. * Arguments    : x,y,z : Color vector.                               *
  76. *                                                                    *
  77. * Return Value : Vector its magnitude.                               *
  78. *                                                                    *
  79. * Comment      :                                                     *
  80. *                                                                    *
  81. \********************************************************************/
  82. static ULONG magnitude(LONG x, LONG y, LONG z)
  83. {
  84.     return(sqrt(x*x + y*y + z*z));
  85. }
  86.  
  87. /********************************************************************\
  88. *                                                                    *
  89. * Name         : index2Color                                         *
  90. *                                                                    *
  91. * Description  : Converts a GEO color index into a RGB color.        *
  92. *                                                                    *
  93. * Arguments    : index : The color index.                            *
  94. *                                                                    *
  95. * Return Value : Vector its magnitude.                               *
  96. *                                                                    *
  97. * Comment      :                                                     *
  98. *                                                                    *
  99. \********************************************************************/
  100. static TColor index2Color(ULONG index)
  101. {
  102.     static TColor col;
  103.     
  104.     /*
  105.     ** Check range
  106.     */
  107.     if (index >= 0 && index < sizeof(colorTbl)/sizeof(TColor)) {
  108.         /*
  109.         ** return table entry
  110.         */
  111.         col.r = colorTbl[index].r;
  112.         col.g= colorTbl[index].g;
  113.         col.b= colorTbl[index].b;
  114.  
  115.         return (col);
  116.     }
  117.  
  118.     /*
  119.     ** Out-of-range color is white, like undefined.
  120.     */
  121.     col.r = 255;
  122.     col.g= 255;
  123.     col.b= 255;
  124.                 
  125.     return (col);
  126. }
  127.  
  128. /********************************************************************\
  129. *                                                                    *
  130. * Name         : color2GEO                                           *
  131. *                                                                    *
  132. * Description  : Matches the nearest color available in the GEO      *
  133. *                color palette.                                      *
  134. *                                                                    *
  135. * Arguments    : red,green,blue : Color values.                      *
  136. *                                                                    *
  137. * Return Value : GEO color index.                                    *
  138. *                                                                    *
  139. * Comment      :                                                     *
  140. *                                                                    *
  141. \********************************************************************/
  142. static ULONG color2GEO (UBYTE red, UBYTE green, UBYTE blue)
  143. {
  144.     ULONG            i;
  145.     ULONG            index = 1;
  146.     TColor            current;
  147.     LONG            best;
  148.     LONG            difference;
  149.   
  150.     current = index2Color(index);
  151.     best =  magnitude(current.r-red,current.g-green,current.b-blue);
  152.  
  153.     for (i = 0; i < sizeof(colorTbl)/sizeof(TColor); i++) {
  154.         current = index2Color(i);
  155.         difference = magnitude(current.r-red,current.g-green,current.b-blue);
  156.         if (difference < best) {
  157.             best = difference;
  158.             index = i;
  159.         }
  160.     }
  161.  
  162.     return (index);
  163. }
  164.  
  165. /********************** Public functions ****************************/
  166.  
  167. /****** geoa.library/td3XSave ******************************************
  168. *   NAME    
  169. *     td3XSave -- Saves the whole space or one to several
  170. *                components of it as a 3D file.
  171. *
  172. *   SYNOPSIS
  173. *    error = td3XSave( spacehandle,filename,type,index,screen)
  174. *                      D1          D2       D3   D4     A0
  175. *
  176. *    TDerrors td3XSave
  177. *         ( ULONG,STRPTR,TDenum,ULONG,struct Screen " );
  178. *
  179. *   FUNCTION
  180. *    The space will be saved in a 3 dimensional representation in the
  181. *    filename, without existence checks.
  182. *    By specifying type, you can save multiple components, all surfaces
  183. *    for example, and by defining index, a single component. One
  184. *    object for example.
  185. *
  186. *    The screen parameter is optional and this functions uses it
  187. *    only if it is set non-NULL, to display a window with
  188. *    additional or special parameters needed to save the file,
  189. *    or for messages.
  190. *   INPUTS
  191. *     spacehandle   - A valid handle of a space.
  192. *    filename      - Name of the file to create.
  193. *    type          - Type of component to save.
  194. *    index         - Index of the component.
  195. *    screen        - Pointer to the work screen.
  196. *    
  197. *   RESULT
  198. *     error - ER_NOERROR      if all went well.
  199. *            ER_NOTYPE       if the type is not supported.
  200. *            ER_NOVERTEX     if there are no vertices
  201. *            ER_NOPOLYGON    if there are no polygons
  202. *            ER_NOMATGROUP   if there are no material groups
  203. *            ER_OVERFLOW     if the component is to big to save.
  204. *            ER_CREATEFILE   if the file can not be created.
  205. *            ER_WRITEDATA    if an error occured while writing data.
  206.  
  207.  
  208.  
  209. *            NOTIMPL      if the function is not implemented.
  210. *            NOMEMORY     if there is not enough memory. 
  211. *            NOMATERIAL   if there are no materials, but they are expected.
  212. *            td errors    if a td call failed.
  213.  
  214.  
  215. *   EXAMPLE
  216. *    error = td3XSave(spacehandle,"ram:test",TD_OBJECT,4,NULL);
  217. *
  218. *   NOTES
  219. *
  220. *   BUGS
  221. *   SEE ALSO
  222. ******************************************************************************
  223. *
  224. */
  225. TDerrors __saveds ASM td3XSave(register __d1 ULONG spacehandle,
  226.                                 register __d2 STRPTR filename,
  227.                                 register __d3 TDenum type,
  228.                                 register __d4 ULONG index,
  229.                                 register __a0 struct Screen *screen) {
  230.  
  231.     BPTR            geofile=NULL;
  232.     ULONG            space,nofv,nofpo,nofmg,mat,i,j,n,vi;
  233.     TDenum            rt;
  234.     TDvectorf        vertex;
  235.     UBYTE            color[3];
  236.     UBYTE            buffer[150];
  237.  
  238.  
  239.     space=spacehandle;
  240.  
  241.     // check the type for the type of output
  242.     switch(type) {
  243.         case TD_OBJECT :
  244.         case TD_POLYMESH :
  245.             tdTypeGet(space,TD_OBJECT,index,&rt);
  246.  
  247.             if(rt==TD_POLYMESH) {
  248.                 tdCurrent(space,TD_OBJECT,index);
  249.  
  250.                 // Check if there are some vertices
  251.                 nofv=tdNofGet(space,TD_VERTEX);
  252.                 if(nofv==0) {
  253.                     return(ER_NOVERTEX);
  254.                 }
  255.                 // Maximum of 65536 vertices
  256.                 if(nofv>65536) {
  257.                     return(ER_OVERFLOW);
  258.                 }
  259.  
  260.                 // Check if there are some polygons
  261.                 nofpo=tdNofGet(space,TD_POLYGON);
  262.                 if(nofpo==0) {
  263.                     return(ER_NOPOLYGON);
  264.                 }
  265.  
  266.                 // Check if there are some matgroups.
  267.                 nofmg=tdNofGet(space,TD_MATGROUP);
  268.                 if(nofmg==0) {
  269.                     return(ER_NOMATGROUP);
  270.                 }
  271.  
  272.                 /* Open the file for output */
  273.                 if((geofile=Open(filename,MODE_NEWFILE))==NULL) return(ER_CREATEFILE);
  274.     
  275.                 /* Change the buffer size of the filehandle to 10k */
  276.                 if (SetVBuf(geofile,NULL,BUF_FULL,10000)!=DOSFALSE) {
  277.                     Close(geofile);
  278.                     return(ER_NOMEMORY);
  279.                 }
  280.  
  281.                 // Write the header and the number of vertices
  282.                 if (FPrintf(geofile,"3DG1\n%ld\n",nofv)==ENDSTREAMCH) {
  283.                     Close(geofile);
  284.                     return(ER_WRITEDATA);
  285.                 }
  286.  
  287.                 // Write the vertices              
  288.                 for(i=1;i<=nofv;i++) {
  289.                     tdVertexGetfv(space,i,&vertex);
  290.                     sprintf(buffer,"%0.4g %0.4g %0.4g\n",vertex.x,vertex.z,vertex.y);
  291.                     if(FPuts(geofile,buffer)!=DOSFALSE) {
  292.                         Close(geofile);
  293.                         return(ER_WRITEDATA);
  294.                     }
  295.                 }
  296.  
  297.                 // Get all matgroups and write down theyr polygons with material
  298.                 for(i=1;i<=nofmg;i++) {
  299.                     tdCurrent(space,TD_MATGROUP,i);
  300.                     if((nofpo=tdNofGet(space,TD_POLYGON))>0) {
  301.                         for(j=1;j<=nofpo;j++) {
  302.                             tdCurrent(space,TD_POLYGON,j);
  303.                             if((nofv=tdNofGet(space,TD_VERTEX))>0) {
  304.                                 // writing the number of vertices in this polygon
  305.                                 if (FPrintf(geofile,"%ld ",nofv)==ENDSTREAMCH) {
  306.                                     Close(geofile);
  307.                                     return(ER_WRITEDATA);
  308.                                 }
  309.                                 for(n=nofv;n>0;n--) {
  310.                                     // handle = index + 1
  311.                                     tdVertexIndexGet(space,n,&vi);
  312.                                     if (FPrintf(geofile,"%ld ",vi-1)==ENDSTREAMCH) {
  313.                                         Close(geofile);
  314.                                         return(ER_WRITEDATA);
  315.                                     }
  316.                                 }
  317.                                 tdChildGetl(space,TD_MATERIAL,&mat);
  318.                                 tdMaterialGetuba(space,TD_DIFFUSE,mat,color);
  319.                                 // write the material index
  320.                                 if (FPrintf(geofile,"%ld\n",color2GEO(color[0],color[1],color[2]))==ENDSTREAMCH) {
  321.                                     Close(geofile);
  322.                                     return(ER_WRITEDATA);
  323.                                 }
  324.                             }
  325.                         }
  326.                     }
  327.                 }
  328.  
  329.                 // Close the file
  330.                 Close(geofile);
  331.             } else {
  332.                 return(ER_NOTYPE);
  333.             }
  334.             break;
  335.         default :
  336.             return(ER_NOTYPE);
  337.     }
  338.  
  339.     return(ER_NOERROR);
  340. }
  341.  
  342. /****** geoa.library/td3XLoad ******************************************
  343. *   NAME    
  344. *     td3XLoad -- Load the whole 3D file, or components out of
  345. *                it into a space.
  346. *
  347. *   SYNOPSIS
  348. *    error = td3XLoad( spacehandle,filename,type,screen,erroffset)
  349. *                      D1          D2       D3    A0    D4
  350. *
  351. *    TDerrors td3XLoad
  352. *         ( ULONG,STRPTR,TDenum,struct Screen " ,ULONG *);
  353. *
  354. *   FUNCTION
  355. *    A file which contains a 3 dimensional represantation will
  356. *    be examined for known components and loaded into the
  357. *    space.
  358. *    By defining another type you can load single components
  359. *    into the space, materials only, or similar.
  360. *
  361. *    The screen parameter is optional and this functions uses it
  362. *    only if it is set non-NULL, to display a window with
  363. *    additional or special parameters needed to save the file,
  364. *    or for messages.
  365. *   INPUTS
  366. *     spacehandle   - A valid handle of a space.
  367. *    filename      - Name of the file to load.
  368. *    type          - Type of component to load.
  369. *    screen        - Pointer to the work screen.
  370. *    erroffset     - Offset where a read error occured.
  371. *    
  372. *   RESULT
  373. *     error - ER_NOERROR       if all went well.
  374. *            ER_NOFILE        if the file is not found.
  375. *            ER_READDATA      if an error occured while reading data.
  376. *            ER_NOMEMORY      if there is not enough memory. 
  377. *            ER_UNKNOWNFORMAT if the file format is unknown.
  378. *            ER_NOVERTEX      if there are no vertices.
  379.  
  380. *            RCNOTIMPL       if the function is not implemented.
  381. *            RCNOMATERIAL    if there are no materials, but they are expected.
  382. *           RCNOPART        if there are no parts, but they are expected.
  383. *            RCNOPOLYGON     if there are no polygons, but they are expected.
  384. *            tdo errors      if a tdo call failed.
  385. *   EXAMPLE
  386. *    error = td3XLoad(spacehandle,"ram:test",TD_SPACE,NULL);
  387. *
  388. *   NOTES
  389. *
  390. *   BUGS
  391. *   SEE ALSO
  392. ******************************************************************************
  393. *
  394. */
  395. TDerrors __saveds ASM td3XLoad(register __d1 ULONG spacehandle,
  396.                                 register __d2 STRPTR filename,
  397.                                 register __d3 TDenum type,
  398.                                 register __a0 struct Screen *screen,
  399.                                 register __d4 ULONG *erroffset) {
  400.  
  401.     ULONG space;
  402.     FILE *fp=NULL;
  403.     char header[10];
  404.     unsigned long vertices=0,polygons=0;
  405.     long material=0,pt=0;
  406.     unsigned long points[1000];
  407.     long i,j,det;
  408.     TDvectorf v;
  409.     TColor color;
  410.     UBYTE ca[3];
  411.  
  412.  
  413.     space=spacehandle;
  414.  
  415.     // check the type for the type of output
  416.     switch(type) {
  417.         case TD_OBJECT :
  418.         case TD_POLYMESH :
  419.             fp=fopen(filename,"r");
  420.             if(fp==NULL) {
  421.                 return(ER_NOFILE);
  422.             }
  423.  
  424.             // initializing the line counter
  425.             (*erroffset)=1;
  426.  
  427.             fscanf(fp,"%4s",header);
  428.             if(strncmp(header,"3DG1",4)!=0) {
  429.                 fclose(fp);
  430.                 return(ER_UNKNOWNFORMAT);
  431.             }
  432.         
  433.             (*erroffset)++;
  434.  
  435.             fscanf(fp,"%ld",&vertices);
  436.             if(vertices==0) {
  437.                 fclose(fp);
  438.                 return(ER_NOVERTEX);
  439.             }
  440.  
  441.             (*erroffset)++;
  442.     
  443.             // creating a new polymesh
  444.             if(tdAdd(space,TD_POLYMESH)!=ER_NOERROR) {
  445.                 fclose(fp);
  446.                 return(ER_NOMEMORY);
  447.             }
  448.             tdCurrent(space,TD_OBJECT,tdNofGet(space,TD_OBJECT));
  449.  
  450.             // initialize the materials and parts
  451.             for(i=0;i<16;i++) {
  452.                 if(tdAdd(space,TD_SURFACE)!=ER_NOERROR) {
  453.                     fclose(fp);
  454.                     return(ER_NOMEMORY);
  455.                 }
  456.  
  457.                 color=colorTbl[i];
  458.                 ca[0]=color.r;ca[1]=color.g;ca[2]=color.b;
  459.                 tdMaterialSetuba(space,TD_DIFFUSE,j=tdNofGet(space,TD_MATERIAL),ca);
  460.  
  461.                 tdCurrent(space,TD_MATERIAL,j);
  462.                 if(tdBegin(space,TD_MATGROUP)!=ER_NOERROR) {
  463.                     fclose(fp);
  464.                     return(ER_NOMEMORY);
  465.                 }
  466.             }
  467.  
  468.             // ensure no currents
  469.             tdEnd(space,TD_MATERIAL);
  470.             tdEnd(space,TD_MATGROUP);
  471.  
  472.             for(i=0;i<vertices;i++,(*erroffset)++) {
  473.                 // GEO z equals to the libraries y
  474.                 if(fscanf(fp,"%f %f %f",&v.x,&v.z,&v.y)==EOF) {
  475.                     fclose(fp);
  476.                     return(ER_READDATA);
  477.                 }
  478.  
  479.                 if(tdVertexAddfv(space,&v)!=ER_NOERROR) {
  480.                     fclose(fp);
  481.                     return(ER_NOMEMORY);
  482.                 }
  483.             }
  484.  
  485.             // reseting detail polygon indicator and polygon count
  486.             // to be able to catch empty lines.
  487.             det=0;
  488.             polygons=0;
  489.  
  490.             while(fscanf(fp,"%ld",&polygons)!=EOF) {
  491.                 // we limit us to Ci_MAXVERINPOLY points per polygon, and skip detail polygons
  492.                 if(polygons>0 && det==0) {
  493.                     for(i=0;i<polygons&&i<Ci_MAXVERINPOLY;i++) {
  494.                         if(fscanf(fp,"%ld",&(points[i]))==EOF) {
  495.                             fclose(fp);
  496.                             return(ER_READDATA);
  497.                         } else {
  498.                             if(points[i]>=vertices) {
  499.                                 fclose(fp);
  500.                                 return(ER_READDATA);
  501.                             }
  502.                         }
  503.                     }
  504.                 } else {
  505.                     // skip all detail polys
  506.                     det=polygons;
  507.                     for(j=0;j<det;j++) {
  508.                         if(fscanf(fp,"%ld",&polygons)!=EOF) {
  509.                             for(i=0;i<=polygons;i++) {
  510.                                 if(fscanf(fp,"%ld",&pt)==EOF) {
  511.                                     fclose(fp);
  512.                                     return(ER_READDATA);
  513.                                 }
  514.                             }
  515.                             polygons=0;
  516.                             (*erroffset)++;
  517.                         }
  518.                     }
  519.  
  520.                     polygons=0;
  521.                     det=0;
  522.                     continue;
  523.                 }
  524.  
  525.                 if(fscanf(fp,"%ld",&material)==EOF) {
  526.                     fclose(fp);
  527.                     return(ER_READDATA);
  528.                 } else {
  529.  
  530.                     // we are using only 16 out of 256 colors.
  531.                     // and we skip detail polygons, color = minus
  532.                     if (material<0) {
  533.                         material*=-1;
  534.                         det=-1;
  535.                     }
  536.                     tdCurrent(space,TD_MATGROUP,(material%16)+1);
  537.                     if(tdBegin(space,TD_POLYGON)!=ER_NOERROR) {
  538.                         fclose(fp);
  539.                         return(ER_NOMEMORY);
  540.                     }
  541.                 }
  542.  
  543.                 // remember, GEO is clockwise, the library counterclockwise
  544.                 for(i=polygons-1;i>=0;i--) {
  545.                     if(tdVertexAssign(space,points[i]+1)!=ER_NOERROR) {
  546.                         fclose(fp);
  547.                         return(ER_NOMEMORY);
  548.                     }
  549.                 }
  550.                 tdEnd(space,TD_POLYGON);
  551.  
  552.                 (*erroffset)++;
  553.                 polygons=0;
  554.             }
  555.  
  556.             fclose(fp);
  557.  
  558.             tdEnd(space,TD_OBJECT);
  559.             
  560.             break;
  561.         default :
  562.             return(ER_NOTYPE);
  563.     }
  564.  
  565.     return(ER_NOERROR);
  566. }
  567.  
  568. /****** geoa.library/td3XCheckFile ******************************************
  569. *   NAME    
  570. *     td3XCheckFile -- Checks if the file is in the format we expected to load.
  571. *
  572. *   SYNOPSIS
  573. *    error = td3XLoad( filename )
  574. *                      D1
  575. *
  576. *    TDerrors td3XCheckFile
  577. *         ( STRPTR );
  578. *
  579. *   FUNCTION
  580. *    The file its header will be examinated to verify if it is the
  581. *    file format we expect to read with the load function.
  582. *   INPUTS
  583. *    filename      - Name of the file to load.
  584. *    
  585. *   RESULT
  586. *     error - ER_NOERROR       if all went well.
  587. *            ER_UNKNOWNFORMAT if the file format is unknown.
  588. *            ER_NOFILE        if the file is not found.
  589. *            ER_READDATA      if an error occured while reading data.
  590. *   EXAMPLE
  591. *    error = td3XCheckFile("ram:test");
  592. *
  593. *   NOTES
  594. *
  595. *   BUGS
  596. *   SEE ALSO
  597. ******************************************************************************
  598. *
  599. */
  600. TDerrors __saveds ASM td3XCheckFile(register __d2 STRPTR filename) {
  601.  
  602.     FILE *fp=NULL;
  603.     char header[10];
  604.  
  605.     // open the file for input
  606.     fp=fopen(filename,"r");
  607.     if(fp==NULL) {
  608.         return(ER_NOFILE);
  609.     }
  610.  
  611.     // check the file type
  612.     fscanf(fp,"%4s",header);
  613.     fclose(fp);
  614.  
  615.     if(strncmp(header,"3DG1",4)!=0) {
  616.         return(ER_UNKNOWNFORMAT);
  617.     }
  618.  
  619.     return(ER_NOERROR);
  620. }
  621.  
  622. /****** geoa.library/td3XExt ******************************************
  623. *   NAME    
  624. *     td3XExt -- Returns the default extension of the file format.
  625. *
  626. *   SYNOPSIS
  627. *    ext = td3XExt ( )
  628. *
  629. *    STRPTR td3XExt
  630. *         ( );
  631. *
  632. *   FUNCTION
  633. *    The default extension of the file format will be returned
  634. *    as READ_ONLY, NULL terminated string which will be only valid
  635. *    as long as the library is opened.
  636. *   INPUTS
  637. *    
  638. *   RESULT
  639. *     ext - String pointer to the extension, or NULL no default.
  640. *   EXAMPLE
  641. *    ext = td3XExt();
  642. *
  643. *   NOTES
  644. *
  645. *   BUGS
  646. *   SEE ALSO
  647. ******************************************************************************
  648. *
  649. */
  650. STRPTR __saveds ASM td3XExt () {
  651.     static STRPTR ext="geo";
  652.  
  653.     return(ext);
  654. }
  655.  
  656. /****** geoa.library/td3XName ******************************************
  657. *   NAME    
  658. *     td3XName -- Returns the file format name string.
  659. *
  660. *   SYNOPSIS
  661. *    name = td3XName ( )
  662. *
  663. *    SRPTR td3XName
  664. *         ( );
  665. *
  666. *   FUNCTION
  667. *    The file format its name will be returned. This string should not 
  668. *    be to large, about 20 characters maximum.
  669. *    The string is READ_ONLY, NULL terminated and only valid as
  670. *    long as the library is opened.
  671. *   INPUTS
  672. *    
  673. *   RESULT
  674. *     name - String pointer to the name, or NULL no one.
  675. *   EXAMPLE
  676. *    name = td3XName();
  677. *
  678. *   NOTES
  679. *
  680. *   BUGS
  681. *   SEE ALSO
  682. ******************************************************************************
  683. *
  684. */
  685. STRPTR __saveds ASM td3XName () {
  686.     static STRPTR name="Videoscape ASCII (TD)";
  687.  
  688.     return(name);
  689. }
  690.  
  691. /****** geoa.library/td3XSaverSupports *************************************
  692. *   NAME    
  693. *     td3XSaverSupports -- This function has to indicate if the saver
  694. *                        is supporting a type of save functionality
  695. *                        or not.
  696. *
  697. *   SYNOPSIS
  698. *    supported = td3XSaverSupports(type)
  699. *                                  D1
  700. *
  701. *    ULONG td3XSaverSupports
  702. *         ( TDenum );
  703. *
  704. *   FUNCTION
  705. *    The main library checks with this function, which types of
  706. *    save possibilities can be made in this module.
  707. *   INPUTS
  708. *    type          - Type of save functionality.
  709. *    
  710. *   RESULT
  711. *     supported - 0 if not and 1 if supported.
  712. *   EXAMPLE
  713. *    supported = td3XSaverSupports(TD_OBJECT);
  714. *
  715. *   NOTES
  716. *
  717. *   BUGS
  718. *   SEE ALSO
  719. ******************************************************************************
  720. *
  721. */
  722. ULONG __saveds ASM td3XSaverSupports(register __d1 TDenum type) {
  723.     switch(type) {
  724.         case TD_OBJECT:
  725.         case TD_POLYMESH:
  726.             return(1);
  727.  
  728.         default:
  729.             return(0);
  730.     }
  731. }
  732.  
  733. /****** geoa.library/td3XLoaderSupports *************************************
  734. *   NAME    
  735. *     td3XLoaderSupports -- This function has to indicate if the loader
  736. *                         is supporting a type of load functionality
  737. *                         or not.
  738. *
  739. *   SYNOPSIS
  740. *    supported = td3XloaderSupports(type)
  741. *                                   D1
  742. *
  743. *    ULONG td3XLoaderSupports
  744. *         ( TDenum );
  745. *
  746. *   FUNCTION
  747. *    The main library checks with this function, which types of
  748. *    load possibilities can be made in this module.
  749. *   INPUTS
  750. *    type          - Type of save functionality.
  751. *    
  752. *   RESULT
  753. *     supported - 0 if not and 1 if supported.
  754. *   EXAMPLE
  755. *    supported = td3XLoaderSupports(TD_OBJECT);
  756. *
  757. *   NOTES
  758. *
  759. *   BUGS
  760. *   SEE ALSO
  761. ******************************************************************************
  762. *
  763. */
  764. ULONG __saveds ASM td3XLoaderSupports(register __d1 TDenum type) {
  765.     switch(type) {
  766.         case TD_OBJECT:
  767.         case TD_POLYMESH:
  768.             return(1);
  769.  
  770.         default:
  771.             return(0);
  772.     }
  773. }
  774.  
  775. /************************* End of file ******************************/
  776.